package com.yzt.message.adapter;

import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.module.LoadMoreModule;
import com.chad.library.adapter.base.module.UpFetchModule;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.yzt.zhuju.network.entity.message.SystemMessageData;
import com.yzt.zhuju.widget.tuiview.TUIView;
import com.yzt.message.R;
import com.yzt.plugin_widget.RoundImageView;

/**
 * author : bob
 * date   : 2022/12/5
 * desc   : 系统通知
 */
public class SystemMessageAdapter extends BaseQuickAdapter<SystemMessageData, BaseViewHolder> implements
        LoadMoreModule, UpFetchModule {

    public SystemMessageAdapter() {
        super(R.layout.item_system_msg);
    }

    @Override
    protected void convert(BaseViewHolder helper, SystemMessageData item) {

        TextView assistantTime = helper.getView(R.id.assistant_time);
        RoundImageView roundImage = helper.getView(R.id.img_content);
        TextView assistantTitle = helper.getView(R.id.community_theme_title);
        TUIView view_status = helper.getView(R.id.view_status);
        TextView subTitle = helper.getView(R.id.subtitle);

//        String response = item.getMessage();
//
//        AssistantMsgDetail result = null;
//        try {
//            result = JSON.parseObject(response, AssistantMsgDetail.class);
//        } catch (Exception e) {
//            e.printStackTrace();
//        }
//        if (result != null) {
//
//            // 时间
//            long timestamp = (long) item.getTimes() * 1000;
//            assistantTime.setText(TimeUtils.millis2String(timestamp));
//
//            // 标题
//
//            assistantTitle.setText(result.getTitle());
//
//            // 内容
//
//            subTitle.setText(result.getContent());
//
//            // 图片内容
//
//            if (result.getPicture() != null && !result.getPicture().equals("")) {
//                Glide.with(getContext()).load(result.getPicture()).into(roundImage);
//                roundImage.setVisibility(View.VISIBLE);
//            } else {
//                roundImage.setVisibility(View.GONE);
//            }
//
//            // 分割线
//            View line = helper.getView(R.id.view_line);
//
//            if (result.getIsShowButton() == 0) {
//                btn.setVisibility(View.GONE);
//                line.setVisibility(View.GONE);
//
//            } else {
//                btn.setVisibility(View.VISIBLE);
//                line.setVisibility(View.VISIBLE);
//                if (TextUtils.isEmpty(result.getButtonTitle())) {
//                    helper.setText(R.id.tv_look, mContext.getString(R.string.look_now));
//                } else {
//                    helper.setText(R.id.tv_look, result.getButtonTitle());
//                }
//            }
//
//            assistantTitle.setSelected(result.getIsShowButton() == 1);
//        }
    }
}